<?php
// Selection du menu a mettre en highlight
$user = false;
$offre = false;
$stage = false;
$portail = false;
$options = false;
$dates = false;
$mail = false;
$administration = false;

if (strpos($_GET['m'], 'user') !== false)
{
    $user = true;
}
elseif (strpos($_GET['m'], 'offre') !== false)
{
    $offre = true;
}
elseif (strpos($_GET['m'], 'stage') !== false)
{
    $stage = true;
}
elseif (strpos($_GET['m'], 'portail') !== false)
{
    $portail = true;
}
elseif (strpos($_GET['m'], 'options') !== false)
{
    $options = true;
}
elseif (strpos($_GET['m'], 'dates') !== false)
{
    $dates = true;
}
elseif (strpos($_GET['m'], 'mails') !== false)
{
    $mail = true;
}
elseif (strpos($_GET['m'], 'administration') !== false)
{
    $administration = true;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>Dashboard - Admin Template</title>
        <link rel="stylesheet" type="text/css" href="<?php echo DS . STYLEBK; ?>css/theme.css" />
        <link rel="stylesheet" type="text/css" href="<?php echo DS . STYLEBK; ?>css/style.css" />
        <link rel="stylesheet" type="text/css" href="<?php echo DS . STYLEBK; ?>css/onglet.css" />
        <script src="<?php echo URL; ?>js/jquery-1.5.1.min.js" type="text/javascript"></script>
        <link rel="stylesheet" href="<?php echo URL; ?>js/south-street/jquery-ui-1.8.11.custom.css" type="text/css" media="screen" />
        <!--[if IE]>
        <link rel="stylesheet" type="text/css" href="css/ie-sucks.css" />
        <![endif]-->
        <script src="<?php echo URL; ?>js/jquery-ui-1.8.11.custom.min.js" type="text/javascript"></script>
        <script src="<?php echo URL; ?>js/script.js" type="text/javascript"></script>
        <script type="text/javascript" src="<?php echo URL; ?>js/lib/jHtmlArea/scripts/jHtmlArea-0.7.0.js"></script>
        <link rel="stylesheet" type="text/css" href="<?php echo URL; ?>js/lib/jHtmlArea/style/jHtmlArea.css" />
        <style>
            div.jHtmlArea div iframe{
                border:1px grey solid;
            }
        </style>
    </head>

    <body>
        <script type="text/javascript">
            $(document).ready(function(){
                <?php if($mail){ ?>
                    $("textarea").htmlarea({
                        toolbar: ["bold", "italic", "underline","|","link", "unlink","|","orderedList","unorderedList","|","p","h1","h2","h3","h4","|","indent","outdent"]
                    });
                <?php }else{ ?>
                    $("textarea").htmlarea({
                        toolbar: ["bold", "italic", "underline","|","link", "unlink","|","orderedList","unorderedList","|","p","h3","h4","|","indent","outdent"]
                    });
                <?php } ?>
                $(".tab_content").hide(); //Hide all content
                
                
                var url = window.location.href;
                var tab = url.split('#');
                if(tab[1])
                {
                    var ong = tab[1].split("b");
                    if(ong[1])
                    {
                        // ACTIVE L'ONGLET DEMANDE
                        $("ul.tabs li#ong"+ong[1]).addClass("active").show();
                        $(".tab_container #tab"+ong[1]).show();
                    }
                    else
                    {
                        $("ul.tabs li:first").addClass("active").show(); //Activate first tab
                        $(".tab_content:first").show(); //Show first tab content
                    }
                }
                else
                {
                    $("ul.tabs li:first").addClass("active").show(); //Activate first tab
                    $(".tab_content:first").show(); //Show first tab content
                }

                //On Click Event
                $("ul.tabs li").click(function() {

                    $("ul.tabs li").removeClass("active"); //Remove any "active" class
                    $(this).addClass("active"); //Add "active" class to selected tab
                    $(".tab_content").hide(); //Hide all tab content

                    var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
                    $(activeTab).fadeIn(); //Fade in the active ID content
                    return false;
                });

                $( ".datepicker" ).datepicker();

                $.datepicker.regional['fr'] = {clearText: 'Effacer', clearStatus: '',
                    closeText: 'Fermer', closeStatus: 'Fermer sans modifier',
                    prevText: '&lt;Préc', prevStatus: 'Voir le mois précédent',
                    nextText: 'Suiv&gt;', nextStatus: 'Voir le mois suivant',
                    currentText: 'Courant', currentStatus: 'Voir le mois courant',
                    monthNames: ['Janvier','F&eacute;vrier','Mars','Avril','Mai','Juin',
                        'Juillet','Ao&ucirc;t','Septembre','Octobre','Novembre','D&eacute;cembre'],
                    monthNamesShort: ['Jan','F&eacute;v','Mar','Avr','Mai','Jun',
                        'Jul','Ao&ucirc;','Sep','Oct','Nov','D&eacute;c'],
                    monthStatus: 'Voir un autre mois', yearStatus: 'Voir une autre ann&eacute;e',
                    weekHeader: 'Sm', weekStatus: '',
                    dayNames: ['Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi'],
                    dayNamesShort: ['Dim','Lun','Mar','Mer','Jeu','Ven','Sam'],
                    dayNamesMin: ['Di','Lu','Ma','Me','Je','Ve','Sa'],
                    dayStatus: 'Utiliser DD comme premier jour de la semaine', dateStatus: 'Choisir le DD, MM d',
                    dateFormat: 'dd/mm/yy', firstDay: 0,
                    initStatus: 'Choisir la date', isRTL: false};
                $.datepicker.setDefaults($.datepicker.regional['fr']);
                
            });
        </script>
        <div id="container">
            <div id="header">
                <h2>Panel de gestion</h2>
                
                <div id="topmenu">
                    <ul>
                        <li<?php if (!$user && !$offre && !$stage && !$portail && !$options && !$dates && !$mail && !administration)
                        {
                            echo ' class="current"';
                        } ?>><a href="<?php echo URL; ?>index.php?m=admin">Dashboard</a></li>
                        <?php if(isAdministrateur ()): ?>
                            <li<?php if ($user)
                            {
                                echo ' class="current"';
                            } ?>><a href="<?php echo URL; ?>index.php?m=admin_users">Utilisateurs</a></li>
                        <?php endif; ?>

                        <li<?php if ($offre)
                        {
                            echo ' class="current"';
                        } ?>><a href="<?php echo URL; ?>index.php?m=admin_offres">Offres</a></li>
                        <li<?php if ($stage)
                        {
                            echo ' class="current"';
                        } ?>><a href="<?php echo URL; ?>index.php?m=admin_stages">Stages</a></li>
                        <?php if(isAdministrateur ()): ?>
                            <li<?php if ($portail)
                            {
                                echo ' class="current"';
                            } ?>><a href="<?php echo URL; ?>index.php?m=admin_portail">Portail</a></li>
                        <?php endif; ?>
                        <li<?php if ($dates)
                        {
                            echo ' class="current"';
                        } ?>><a href="<?php echo URL; ?>index.php?m=admin_dates">Dates</a></li>
                        <?php if(isAdministrateur ()): ?>
                        <li<?php if ($mail)
                        {
                            echo ' class="current"';
                        } ?>><a href="<?php echo URL; ?>index.php?m=admin_mails">Mails</a></li>
                        <?php endif; ?>
                        <?php if(isAdministrateur ()): ?>
                            <li<?php if ($options)
                            {
                                echo ' class="current"';
                            } ?>><a href="<?php echo URL; ?>index.php?m=admin_options">Options</a></li>
                        <?php endif; ?>
                        <?php if(isAdministrateur ()): ?>
                            <li<?php if ($administration)
                            {
                                echo ' class="current"';
                            } ?>><a href="<?php echo URL; ?>index.php?m=admin_administration">Administration</a></li>
                        <?php endif; ?>
                        <li style="float:right"><a href="<?php echo URL; ?>">Retour site</a></li>
                    </ul>
                    
                </div>
            </div>